filterOrElse

abstract fun filterOrElse(predicate: (T) -> Boolean, throwable: (T) -> Throwable): Try<T>

Returns the same Success if the predicate is satisfied for the value. Otherwise returns a Failure containing the given throwable.

Return

The same Success if the predicate is satisfied for the value. Otherwise returns a Failure containing the given throwable.

Since

1.2

Parameters

predicate

Predicate function.

throwable

Function providing a throwable to be used when the predicate is not satisfied.